
install(FILES ${PROJECT_ROOT}/setup/vhs.ini DESTINATION conf)
install(FILES ${PROJECT_ROOT}/doc/Deploy.docx DESTINATION doc)


if(WIN32)
	install(FILES ${PROJECT_ROOT}/bin/sqlite3.dll DESTINATION .)
    
else()
		
	install(PROGRAMS ${PROJECT_ROOT}/setup/vhs.sh DESTINATION .)
	install(PROGRAMS ${PROJECT_ROOT}/setup/install.sh DESTINATION .)
	install(PROGRAMS ${PROJECT_ROOT}/setup/uninstall.sh DESTINATION .)
	install(PROGRAMS ${PROJECT_ROOT}/setup/vhs.service DESTINATION .)
	
    install(FILES ${PROJECT_ROOT}/lib/libsqlite3.so DESTINATION lib)
    install(DIRECTORY ${THIRD_PARTY}/mysql/lib/ DESTINATION lib FILES_MATCHING PATTERN "libmysqlclient*")
	install(DIRECTORY ${THIRD_PARTY}/soci/lib/ DESTINATION lib FILES_MATCHING PATTERN Debug EXCLUDE  PATTERN Release EXCLUDE  PATTERN "lib*.so*")
		
endif()

set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)
#include(InstallRequiredSystemLibraries)

#set(CPACK_PACKAGE_DIRECTORY ${PROJECT_ROOT})
set(CPACK_PACKAGE_NAME "vhs")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "vhs")
set(CPACK_PACKAGE_VENDOR "longwits.com")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")


if(UNIX)
	SET(CPACK_GENERATOR "TGZ")
	
	if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
		SET(OS arm)
	else()
		SET(OS linux)
	endif()
		
else()
	SET(CPACK_GENERATOR "ZIP")
	SET(OS win)
endif()

set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/dist") 
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${OS}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")  

include(CPack)
